def process_words(input_str):
    # 将输入字符串按空格和制表符分割成单词列表
    words = input_str.split()
    
    # 将所有单词转换为小写
    words = [word.lower() for word in words]
    
    # 去重
    unique_words = list(dict.fromkeys(words))
    
    # 格式化：每行13个单词，单词之间用空格区分
    formatted_words = []
    for i in range(0, len(unique_words), 13):
        line = ' '.join(unique_words[i:i+13])
        formatted_words.append(line)
    
    # 添加中文翻译
    translated_words = []
    for line in formatted_words:
        translated_line = '# ' + ' '.join([get_translation(word) for word in line.split()])
        translated_words.append(translated_line)
    
    # 合并原始单词和翻译
    result = []
    for i in range(len(formatted_words)):
        result.append(formatted_words[i])
        result.append(translated_words[i])
    
    return '\n'.join(result)

# 获取单词的中文翻译（这里需要实现具体的翻译逻辑）
def get_translation(word):
    # 这里只是一个示例，实际应用中需要根据实际情况实现翻译逻辑
    translation_dict = {
        'book': '书',
        'ruler': '尺子',
        'pencil': '铅笔',
        # 添加更多的单词翻译
    }
    return translation_dict.get(word, '未找到翻译')

# 示例用法
if __name__ == "__main__":
    with open('E:\\dev\\code\\python\\code-kids-typing\\小学英语词汇.txt', 'r', encoding='utf-8') as file:
        input_str = file.read()
    
    result = process_words(input_str)
    print(result)